import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state:{
    userAvatar:'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F4k%2Fs%2F02%2F2109242332225H9-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1664202098&t=e855507e92c9783239591c61021bb74f',
    userName:''
  },
  mutations:{
    SETPHOTO(state,value){
      state.userAvatar = value
    },
    setUserName(state,value){
      state.userName = value
    }
  },
  actions:{
    setphoto({commit},value){
      console.log('保存头像到vuex')
      commit('SETPHOTO',value)
    }
  }
})
